﻿@model Telerik.Web.Mvc.GridModel<PollModel>
@using Telerik.Web.Mvc.UI

@{
    var gridPageSize = EngineContext.Current.Resolve<SmartStore.Core.Domain.Common.AdminAreaSettings>().GridPageSize;
    
    //page title
    ViewBag.Title = T("Admin.ContentManagement.Polls").Text;
}
<div class="section-header">
    <div class="title">
        <i class="fa fa-tasks"></i>
        @T("Admin.ContentManagement.Polls")
    </div>
    <div class="options">
        <a href="@Url.Action("Create")" class="btn btn-primary">
			<i class="fa fa-plus"></i>
			<span>@T("Admin.Common.AddNew")</span>
		</a>
    </div>
</div>

<div>
	@(Html.Telerik().Grid<PollModel>()
		.Name("polls-grid")
		.BindTo(Model.Data)
		.Columns(columns =>
		{
			columns.Bound(x => x.Name)
				.Width(400)
				.Template(x => Html.ActionLink(x.Name, "Edit", new { id = x.Id }))
				.ClientTemplate("<a href=\"Edit/<#= Id #>\"><#= Name #></a>");
			columns.Bound(x => x.LanguageName)
					.Width(150);
			columns.Bound(x => x.DisplayOrder)
				.Width(100)
				.Centered();
			columns.Bound(x => x.Published)
				.Width(100)
				.Template(item => @Html.SymbolForBool(item.Published))
				.ClientTemplate(@Html.SymbolForBool("Published"))
				.Centered();
			columns.Bound(x => x.ShowOnHomePage)
				.Width(100)
				.Template(item => @Html.SymbolForBool(item.ShowOnHomePage))
				.ClientTemplate(@Html.SymbolForBool("ShowOnHomePage"))
				.Centered();
			columns.Bound(x => x.StartDate)
				.Width(180);
			columns.Bound(x => x.EndDate)
				.Width(180);
		})
		.Pageable(settings => settings.Total(Model.Total).PageSize(gridPageSize).Position(GridPagerPosition.Both))
		.DataBinding(dataBinding => dataBinding.Ajax().Select("List", "Poll"))
		.PreserveGridState()
		.EnableCustomBinding(true))
</div>
